package fm.service.impl;

import fm.dao.HibernateBaseDao;
import fm.entity.OrderArticleAd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleAdServiceImpl {


    @Autowired
    HibernateBaseDao baseDao;


    public OrderArticleAd getById(Long id) {
        return (OrderArticleAd) baseDao.getById(OrderArticleAd.class, id);
    }

    public List<OrderArticleAd> getByOrderTransactionOrderId(String transactionOrderId) {

        String hql = "from OrderArticleAd oa where oa.transactionOrderId=?";

        return (List<OrderArticleAd>) baseDao.queryForList(hql, transactionOrderId);
    }

    public OrderArticleAd updateOrder(OrderArticleAd order) {
        baseDao.update(order);
        return order;
    }
}
